﻿#ifndef REALTIMEDATA_H
#define REALTIMEDATA_H

#include <QWidget>
#include <QTimer>
#include <QtCharts/QChart>
#include <QtCharts/QLineSeries>
#include <QtCharts/QDateTimeAxis>
#include <QtCharts/QValueAxis>


#include "Window/mydialog.h"
#include "../Console/tables.h"
#include "Window/Charts/u_chart.h"
#include "Window/Charts/u_chartview.h"
#include "Window/mainwindow.h"

#define RED "min-width:20px;min-height:20px; max-width:20px;max-height:20px;border-radius:10px;border:1px solid black;background:red;"
//#define WHITE "min-width:20px;min-height:20px; max-width:20px;max-height:20px;border-radius:10px;border:1px solid black;background:rgba(100,100,140);"
#define GREEN "min-width:20px;min-height:20px; max-width:20px;max-height:20px;border-radius:10px;border:1px solid black;background:rgba(0,255,0);"
#define GREEN1 "min-width:20px;min-height:20px; max-width:20px;max-height:20px;border:1px solid black;background:rgba(0,255,0);"
#define BLUE "min-width:20px;min-height:20px; max-width:20px;max-height:20px;border:1px solid black;background:blue;"
#define WHITE "min-width:20px;min-height:20px; max-width:20px;max-height:20px;border:1px solid black;background:white;"
using namespace QtCharts;

class MainWindow;
class RealTimeData : public MyDialog
{
    Q_OBJECT
public:
    explicit RealTimeData(QString devCode, QWidget *parent = nullptr);

    void initWidget();

    void setUpConnections();

    void initchart(QString name);
signals:

public slots:
    void showData();
    void CMDChange( int sr);
public:
    QLineSeries *series0;
    QLineSeries *series1;
    QLineSeries *series2;
    Chart  *chart;
    ChartView *chartView;
    QDateTimeAxis *axisX;

    QString devCode;
    QTimer *timer;
    QTableWidget    *tableWidget1;

    QComboBox *CMDbox;

    QLabel *labTime;

    QLabel *labLaunch;
    QLabel *labLaunch1;
    QLabel *labLaunch2;

    QLabel *labRef;
    QLabel *labRef1;
    QLabel *labRef2;

    QLabel *labZhu;
    QLabel *labZhu1;
    QLabel *labZhu2;

    QList<QLabel*> labList;
};

#endif // REALTIMEDATA_H
